package com.carl.zeus.common.util;


import com.carl.zeus.common.constant.BusinessCode;
import com.carl.zeus.common.constant.BusinessMsg;

/**
 * 后台管理系统返回码信息帮助类
 *
 * @author zcm
 * @date 2017/7/11
 */

public class BusinessMsgUtil {


    /**
     * 返回消息代码code 和 message
     *
     * @param businessCode 返回码
     * @return
     */
    public static BusinessMsg returnCodeMessage(BusinessCode businessCode) {
        return returnCodeMessage(businessCode, null);
    }

    /**
     * 返回消息代码和数据
     *
     * @param code 返回码
     * @param data    返回数据
     * @return
     */
    public static BusinessMsg returnCodeMessage(BusinessCode code, Object data) {
        BusinessMsg businessMsg = new BusinessMsg();
        businessMsg.setCode(code.getCode());
        businessMsg.setMessage(code.getMsg());
        businessMsg.setData(data);
        return businessMsg;
    }
}
